import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

let modules = {};

// 初始化全局 vuex 文件
const CommonStores = require.context('./modules', false, /\.js$/);
CommonStores.keys().forEach(key => {
    var _key = key.replace(/(\.\/|\.js)/g, '')
    modules[_key] = CommonStores(key).default
});

export default new Vuex.Store({
    modules,
    plugins: [],
    strict: false
})